<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>books</title>
</head>
<body>
<form method="post">
    {{ form.csrf_token() }}
    {{ form.author.label }}{{ form.author }}<br>
    {{ form.book.label }}{{ form.book }}<br>
    {{ form.submit }}<br>
    {% for message in get_flashed_messages() %}
        {{ message }}
    {% endfor %}
</form>

<hr>
<ul>
{# 循环作者 #}
{% for author in authors %}
        <li>{{ author.name }}<a href="{{ url_for('delete_author',author_id=author.id) }}">删除</a></li>
        <ul>
        {# 循环书籍 #}
            {% for book in author.books %}
                <li>{{ book.name }}<a href="{{ url_for('delete_book',book_id=book.id) }}">删除</a></li>
            {% else %}
                <li>无</li>
            {% endfor %}
        </ul>
{% endfor %}
</ul>



</body>
</html>